package com.lcw.lostandfound.mapper;

import com.lcw.lostandfound.pojo.Admin;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface AdminMapper {

    @Insert({"insert into t_admin(name,password,type) values (#{name},#{password},#{type})"})
    int addAdmin(Admin admin);

    @Select({"select * from t_admin where name = #{name} and password = #{password}"})
    Admin findAdmin(String name,String password);
    @Select({"select * from t_admin where id = #{id}"})
    Admin findAdminById(Integer id);
    @Select({"select * from t_admin"})
    List<Admin> findAllAdmin();

    @Delete({"delete from t_admin where id = #{id}"})
    int deleteAdminById(Integer id);

    @Update({"update t_admin set name=#{name},password=#{password},type=#{type} where id =#{id}"})
    int updateAdmin(Admin admin);
}
